package edu.sctu.wulixia.month6.day20150607;

import java.util.Calendar;

/**
 * Created by user05 on 2015/6/7.
 */
public class CompareTime {

    public void getTimeCompare(){
        Calendar calendar = Calendar.getInstance();
//现在的时间(单位：毫秒)

        long nowTime = calendar.getTimeInMillis();
            System.out.println(nowTime);

//设置需要的时间

// 第二个参数是设置月的，月是基于0的
        //arg list:year,month,day,hour,minute,second
            calendar.set(2015, 5, 4, 11, 23, 0);
        long time = calendar.getTimeInMillis();
        long second = (nowTime-time)/1000;
        long minute =second/60;
        int hour =(int)minute/60;
        int day = hour/24;
        System.out.println("2015年6月4日11:23:00距离现在的时间为："+
                day+"天"+(hour-day*24)+"小时"+(minute-hour*60)+
                "分"+(second-minute*60)+"秒");
    }

}
